import request from '@/config/axios'

// 物资流转 VO
export interface AssetsFlowVO {
  id: number // 编号
  categoryId: number // 分类ID
  assetType: number // 物资类型
  assetId: number // 物资ID
  assetCode: string // 物资编号
  assetName: string // 物资名称
  count: number // 数量
  status: number // 状态
  userIds: string // 领用人
  userNames: string // 领用人
  remark: string // 备注
}

// 物资流转 API
export const AssetsFlowApi = {
  // 查询物资流转分页
  getAssetsFlowPage: async (params: any) => {
    return await request.get({ url: `/school/assets-flow/page`, params })
  },

  // 查询物资流转详情
  getAssetsFlow: async (id: number) => {
    return await request.get({ url: `/school/assets-flow/get?id=` + id })
  },

  // 新增物资流转
  createAssetsFlow: async (data: AssetsFlowVO) => {
    return await request.post({ url: `/school/assets-flow/create`, data })
  },

  // 修改物资流转
  updateAssetsFlow: async (data: AssetsFlowVO) => {
    return await request.put({ url: `/school/assets-flow/update`, data })
  },

  // 删除物资流转
  deleteAssetsFlow: async (id: number) => {
    return await request.delete({ url: `/school/assets-flow/delete?id=` + id })
  },

  // 导出物资流转 Excel
  exportAssetsFlow: async (params) => {
    return await request.download({ url: `/school/assets-flow/export-excel`, params })
  },
}